﻿@model CustomerModel
@{
    //page title
    ViewBag.Title = T("Admin.Customers.Customers.EditCustomerDetails").Text;
}
@using (Html.BeginForm())
{
    <div class="section-header">
        <div class="title">
            <img src="@Url.Content("~/Administration/Content/images/ico-customers.png")" alt="" />
            @T("Admin.Customers.Customers.EditCustomerDetails") - @Model.LastName @Model.FirstName
            @Html.ActionLink("(" + T("Admin.Customers.Customers.BackToList") + ")", "List")
        </div>
        <div class="options">
            <input type="submit" name="save" class="k-button" value="@T("Admin.Common.Save")" />
            <input type="submit" name="save-continue" class="k-button" value="@T("Admin.Common.SaveContinue")" />
            <input type="button" id="sendemail" class="k-button" value="@T("Admin.Customers.Customers.SendEmail")" />
            <input type="button" id="sendprivatemessage" class="k-button" value="@T("Admin.Customers.Customers.SendPM")" />
            <span id="customer-delete" class="k-button">@T("Admin.Common.Delete")</span>
        </div>
    </div>
    @Html.Partial("_CreateOrUpdate", Model)
}
@Html.DeleteConfirmation("customer-delete")

@*send email form*@
<div id="sendemail-window" style="display:none;">
    @using (Html.BeginForm("SendEmail", "Customer", new {id = Model.Id}))
    {
        <table style="text-align:left;">
            <tr>
                <td class="adminTitle">
                    @Html.NopLabelFor(model => model.SendEmail.Subject):
                </td>
                <td class="adminData">
                    @Html.EditorFor(model => model.SendEmail.Subject)
                    @Html.ValidationMessageFor(model => model.SendEmail.Subject)
                </td>
            </tr>
            <tr>
                <td class="adminTitle">
                    @Html.NopLabelFor(model => model.SendEmail.Body):
                </td>
                <td class="adminData">
                    @Html.TextAreaFor(model => model.SendEmail.Body, new {style = "Width: 450px; Height: 350px;"})
                    @Html.ValidationMessageFor(model => model.SendEmail.Body)
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="submit" class="k-button" value="@T("Admin.Customers.Customers.SendEmail")" />
                </td>
            </tr>
        </table>
    }
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#sendemail").click(function (e) {
            e.preventDefault();
            var window = $("#sendemail-window");
            if (!window.data("kendoWindow")) {
                window.kendoWindow({
                    modal: true,
                    width: "600px",
                    title: "@T("Admin.Customers.Customers.SendEmail")",
                    actions: ["Close"]
                });
            }
            window.data('kendoWindow').center().open();
        });
    });
</script>


@*send PM form*@
<div id="sendprivatemessage-window" style="display:none;">
    @using (Html.BeginForm("SendPm", "Customer", new { id = Model.Id }))
    {
    <table style="text-align: left;">
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.SendPm.Subject):
            </td>
            <td class="adminData">
                @Html.EditorFor(model => model.SendPm.Subject)
                @Html.ValidationMessageFor(model => model.SendPm.Subject)
            </td>
        </tr>
        <tr>
            <td class="adminTitle">
                @Html.NopLabelFor(model => model.SendPm.Message):
            </td>
            <td class="adminData">
                @Html.TextAreaFor(model => model.SendPm.Message, new { style = "Width: 350px; Height: 250px;" })
                @Html.ValidationMessageFor(model => model.SendPm.Message)
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" class="k-button" value="@T("Admin.Customers.Customers.SendPM")" />
            </td>
        </tr>
    </table>
    }
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#sendprivatemessage").click(function (e) {
            e.preventDefault();
            var window = $("#sendprivatemessage-window");
            if (!window.data("kendoWindow")) {
                window.kendoWindow({
                    modal: true,
                    width: "500px",
                    title: "@T("Admin.Customers.Customers.SendPM")",
                    actions: ["Close"]
                });
            }
            window.data('kendoWindow').center().open();
        });
    });
</script>